-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command Palette: Fix a crash when transform to a block without icon #55676
Conversation
Size Change: +3 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
The command to transform blocks itself was implemented in #52509. This feature is part of Gutenberg 16.5, so it will be bundled with WordPress 6.4 for the first time. There are probably many cases where custom blocks without icons are used, so there may be many users who encounter this error. I don't know if the backport will be done in time, but I will add a backport label just in case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix, @t-hamano! As this is a regression in 6.4, with the likelihood of crashing the editor for numerous people, I'll go ahead to merge and cherry-pick for inclusion in RC3.
Cherry-picked in b95ea5d. |
Fixes #55668
What?
This PR fixes a critical error that occurs when trying to convert a block with no icon in the command palette.
Why?
If the block has an icon, the
icon
variable will have a React element in thesrc
key. But if it's not, theicon
variable is a string calledblock-defaut
, so it will fail to render.How?
To handle the case where the block does not have an icon, we need to use the
BlockIcon
component.Testing Instructions
Run the code below in your browser console to temporarily register a custom block.